<template>
  <div>
    <div class="notice-bar">
      <div class="notice-bar-title">最新<span style="color:rgb(51,153,254)">成交记录</span></div>
      <marquee scrollamount="8">
        <p style="display: inline-block; margin-right: 10px;" v-for="item , index in subsidiary" :key="index">
          ***<span style="color:#fe6a05">{{ item.consumname }}{{item. pirce }}</span>元
        </p>

      </marquee>
    </div>
  </div>
</template>

<script>
import api from '@/api/index'
export default {
  name: 'notice',
  data () {
    return {
      subsidiary: '',
      time: null
    }
  },

  mounted () {
    this.notice()
  },
  methods: {
    notice () {
      clearTimeout(this.time)
      var self = this
      api.getConsumlist().then(res => {
        this.subsidiary = res.data.data
      })

      this.time = setTimeout(() => {
        self.notice()
      }, 10 * 1000)
    }
  },
  destroyed () {
    clearTimeout(this.time)
  }
}
</script>
